this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};(function(t,n){"use strict";function e(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<span class="ui-publication-name">ERROR! ',"</span>\n\t\t"]);e=function n(){return t};return t}function i(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<span class="ui-publication-name">SUCCESS!</span>\n\t\t']);i=function n(){return t};return t}function a(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<span class="ui-publication-name">Please wait...</span>\n\t\t']);a=function n(){return t};return t}function r(){var t=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="ui-publication">\n\t\t\t\t<div>Publication dialog</div>\n\t\t\t\t<div>URL: <a href="','" target="_blank">',"</a></div>\n\t\t\t\t","\n\t\t\t</div>\n\t\t"]);r=function n(){return t};return t}var s=function(){function t(n){babelHelpers.classCallCheck(this,t);babelHelpers.defineProperty(this,"dialog",null);this.siteId=n.siteId;this.landingId=n.landingId;this.url=n.url}babelHelpers.createClass(t,[{key:"publication",value:function t(e){var i=this;var a=e==="site"?"Site::publication":"Landing::publication";var r={data:e==="site"?{id:this.siteId}:{lid:this.landingId},actionType:"rest",sessid:BX.message("bitrix_sessid")};this.renderPopup();BX.ajax({url:n.Uri.addParam(window.location.href,{action:a}),data:r,dataType:"json",method:"POST",onsuccess:function t(n){if(n.type==="error"){console.log(n.result);i.renderErrorPopupContent(n.result[0].error_description)}else{i.renderSuccessPopupContent()}}})}},{key:"renderPopup",value:function t(){if(!this.dialog){this.dialog=new BX.PopupWindow("landing-publication-confirm",null,{content:"",titleBar:{content:"Publication"},offsetLeft:0,offsetTop:0,buttons:[new BX.PopupWindowButton({text:"OK",events:{click:function t(){this.popupWindow.close()}}})]})}this.renderWaitPopupContent();this.dialog.show()}},{key:"renderContent",value:function t(e){this.dialog.setContent(n.Tag.render(r(),this.url,this.url,e))}},{key:"renderWaitPopupContent",value:function t(){this.renderContent(n.Tag.render(a()))}},{key:"renderSuccessPopupContent",value:function t(){this.renderContent(n.Tag.render(i()))}},{key:"renderErrorPopupContent",value:function t(i){this.renderContent(n.Tag.render(e(),i))}}],[{key:"getInstance",value:function n(e){if(!t.instance){t.instance=new t(e)}return t.instance}}]);return t}();babelHelpers.defineProperty(s,"instance",null);t.Publication=s})(this.BX.Landing.Dialog=this.BX.Landing.Dialog||{},BX);
//# sourceMappingURL=publication.bundle.map.js